const DB = require('../tools/mysql')

module.exports = async ctx => {
    const w = {}
    if (!ctx.request.body.istest) {
        w['card.show'] = 1
    }
    ctx.body = await DB('card')
        .join('style', 'card.style', '=', 'style.id')
        .join('kind', 'card.kind', '=', 'kind.id')
        .select('card.id', 'card.title', 'style.code as style', 'card.kind', 'kind.name as kind_name', 'card.display_url')
        .where(w)
}